<!DOCTYPE HTML>
<html>
<head>
    <title>Purple_loginform Website Template | Home :: w3layouts</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- -->
    <script>var __links = document.querySelectorAll('a');function __linkClick(e) { parent.window.postMessage(this.href, '*');} ;for (var i = 0, l = __links.length; i < l; i++) {if ( __links[i].getAttribute('data-t') == '_blank' ) { __links[i].addEventListener('click', __linkClick, false);}}</script>
    <script src="js/jquery.min.js"></script>
    <script>

  


        $(document).ready(function(c) {


        var message=getQueryString('message')
        if(message){
            $('#message').html(message);
        }else{
             $('#message').html('');
        }

        function getUrlVars()  
            {  
                var vars = [], hash;  
                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');  
                for(var i = 0; i < hashes.length; i++)  
                {  
                    hash = hashes[i].split('=');  
                    vars.push(hash[0]);  
                    vars[hash[0]] = hash[1];  
                }  
                return vars;  
            }  

        function getQueryString(name) { 
              var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
              var r = window.location.search.substr(1).match(reg); 
              if (r != null) return decodeURI(r[2]); return null; 
        }



         $("#form").submit(function(e){
               $.ajax({
                  type: 'POST',
                  url: '/demo/hello.do',
                  data:$("#form").serialize(),
                  dataType: 'json',
                  success: function(res) {
                    if(res.code=='1'){
                        window.location.replace('/index.html');
                    }else{
                         window.location.replace('/login.html?message='+res.message);
                    }
                 }

                });


         });
    });

 

    </script>
</head>
<body>
<!-- contact-form -->
<div class="message warning">
    <div class="inset">
        <div class="login-head">
            <h1>用户管理系统</h1>
            <div class="alert-close"> </div>
        </div>
        <form  method="post" id="form">

            <li>
                <input type="text" class="text"  placeholder="请输入登录名" name="loginName" value="" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}"><a href="#" class=" icon user"></a>
            </li>
            <div class="clear"> </div>
            <li>
                <input type="password" value=""   placeholder="请输入密码" name="password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}"> <a href="#" class="icon lock"></a>
            </li>
            <span style="color: red" id="message"></span>


            <div class="clear"> </div>
            <div class="submit">
                <input type="submit"  name="submit"  onclient style="float:right">
                <div class="clear">  </div>
            </div>

        </form>
    </div>
</div>
</div>
<div class="clear"> </div>
<!--- footer --->
<div class="footer">
</div>

</body>
</html>